/**
 * ClassName:Learn1
 * Package:PACKAGE_NAME
 * Description:
 *
 * @Author:@郭先森
 * @Create:2025/7/26 - 10:07
 * @Version:v1.0
 */
public class Learn1 {
    public static void main(String[] args) {
        Thread thread=new Thread(()->{
            //判断是否是守护线程isDaemon
            System.out.println(Thread.currentThread().getName()+"::"+ Thread.currentThread().isDaemon());
            while (true){
                //加一个死循环，用户线程只要还存活，就算主线程已经结束，那这个时候JVM还是存活的状态
            }
        },"aa");
        //设置为守护线程,设置为守护线程后，若所有的非守护线程都结束，那么守护线程也将会结束
        thread.setDaemon(true);
        thread.start();
        System.out.println(Thread.currentThread().getName()+" over :: "+Thread.currentThread().isDaemon());
    }
}
